<?php
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            佛祖保佑       永无BUG
*/
namespace App\Http\Controllers;
use App\Services\MessageService;
use App\Services\WechatService;
use App\Tools\CurlTools;
use App\Tools\JsonTools;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
class WechatController extends Controller
{
    public function check(){
        return (new WechatService())->checkToken();
    }

    /**
     * @Notes:
     * @Author: 遇见
     * @Date: 2022/11/23
     * @Time: 13:43
     * @return mixed
     * 处理临时文件素材
     */
    public function uploadFile(){
        $file = \request()->file('file')->store('image');
        $files= (new WechatService())->updateFiles($file);
        if(empty($files)){
            return JsonTools::JsonError();
        }
        return  $file;
    }

}
